package dao;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import model.User;

public class TXTUsersDAO implements IUsersDAO {
	
	@Override
	public List<User> getUsers() {
		List<User> list = new ArrayList<User>();
		//IUser user;
	     try {
	    	 BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("files\\users.txt")));
	         while (in.ready()) {
	             String s = in.readLine();
	             String[] f = s.split(":",3);	             
	             list.add(new User(f[0], f[1]));
	        	// users.addNewUser(user);        	 
	         }
	         in.close();
	    } catch (IOException e) {
	    }	 
	    return list;
	}
	
}
